/*
 * Window.hpp
 *
 *  Created on: 29-11-2010
 *      Author: Przemek
 */

#pragma once

#include "UserInterface.hpp"
#include "geometry/Dimension.hpp"
#include "pch.hpp"

/*
 *	Class which creates the window for openGL using SDL. Then displays user interface and handles
 *	system independent events. If the event is GUI like (key pressed, mouse pressed) then it is dispatched
 *	to user interface (in raw SDL event condition).
 */
class Window
{
	private:
		static const Dimension BASE_SIZE;
		static const Uint32 SLEEP_MILLIS_ON_IDLE;
		static const bool FULLSCREEN;
		UserInterface* userInterface;
		bool running;
		bool active;

	public:
		Window();
		~Window();
		void init();
		void run();

	private:
		void initSDLForOgl();
		Uint32 getVideoModeFlags();
		// called after every resive sdl event
		void windowSizeChanged(const Dimension& windowSize);
		void initOglSettings();

		void processSDLEvent(const SDL_Event& event);
		void processSDLActiveEvent(const SDL_ActiveEvent& event);
		void drawFrame();
};

